from docx import Document

def parse_docx(file_path):
    try:
        doc = Document(file_path)
        content = "\n".join([para.text.strip() for para in doc.paragraphs if para.text.strip()])
        print(f"成功解析.docx文件，内容长度：{len(content)}字符")
        return content
    except Exception as e:
        print(f"解析.docx文件失败，错误信息：{e}")
        raise